/*******************************************************************************
 * Copyright (c) 2012 AwOiSoAk.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     $AwOiSoAk - initial API and implementation
 ******************************************************************************/
package com.awoisoak.dundeeguide;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class Restaurants extends Activity implements OnItemClickListener {
	
	private String[] stringRestaurants;
	private ListView listViewRestaurants;
	private ArrayAdapter<String> aa;
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.restaurants);
		
		stringRestaurants= new String[] {"The Byzantium","Marco Polo","Beiderbeckes","Pancake Place",
										 "Shehzad Balti Tandoori","Rancho Pancho"};
		listViewRestaurants = (ListView)findViewById(R.id.listViewRestaurants);
		aa = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,stringRestaurants);
		listViewRestaurants.setAdapter(aa);
		listViewRestaurants.setOnItemClickListener(this);
		

}

	@Override
	public void onItemClick(AdapterView<?> av, View v, int position, long arg3) {
		String item = stringRestaurants[position].toString();
		Intent i;
		String coord= null;
		String website = null;
		int explanation=0;
		int iconPlace=0;
		
			if (item=="The Byzantium"){
				coord="56.459441,-2.980142";
				iconPlace=R.drawable.ic_bread; 
				website="http://www.byzantiumrestaurant.com/Dundee/Home/";  
				explanation=R.string.The_Byzantium;}

			
			else if (item=="Marco Polo"){
				coord="56.46093,-2.9657";
				iconPlace=R.drawable.ic_italy; 
				website="http://www.marcopolocuisine.co.uk/";  
				explanation=R.string.Marco_Polo;}
			
			else if (item=="Beiderbeckes"){
				coord="56.461082,-2.986007";
				iconPlace=R.drawable.ic_burger; 
				website="http://www.beiderbeckesbistro.co.uk/";  
				explanation=R.string.Beiderbeckes;}
			
			else if (item=="Pancake Place"){
				coord="56.461162,-2.970873";
				iconPlace=R.drawable.ic_cookies; 
				website="http://thepancakeplace.net/";  
				explanation=R.string.Pancake_Place;}
			
			else if (item=="Shehzad Balti Tandoori"){
				coord="56.481442,-3.021983";
				iconPlace=R.drawable.ic_india; 
				website="http://www.ashokarestaurants.com/Ashoka%20Shak%20Dundee/";  
				explanation=R.string.Shehzad_Balti_Tandoori;}

			else if (item=="Rancho Pancho"){
				coord="56.460992,-2.966922";
				iconPlace=R.drawable.ic_mexico; 
				website="http://www.ranchopancho.com/";  
				explanation=R.string.Rancho_Pancho;}


		i = new Intent(Restaurants.this,Restaurant.class);  
		i.putExtra("tag_coordinate", coord);
		i.putExtra("tag_place", item);
		i.putExtra("tag_explanation", explanation);
		i.putExtra("tag_icon", iconPlace);
		i.putExtra("tag_website", website);
		startActivity(i);
			
			
		
	}
}
